package _03HashSet存储自定义对象_重点;

import java.util.HashSet;
import java.util.Set;

/**
 * 如果两个学生的年龄姓名相同，让hashset去重
 */
public class Demo {
    public static void main(String[] args) {
        Set<Student> studentSet = new HashSet<Student>();

        studentSet.add(new Student("aaa",18));
        studentSet.add(new Student("bbb",17));
        studentSet.add(new Student("ccc",19));
        studentSet.add(new Student("ccc",19));

        for (Student s : studentSet){
            System.out.println(s);
        }
    }
}
